package com.yanqu.road.server.cmd.activity.stronghold;

import com.yanqu.road.pb.activity.StrongholdActivityProto;
import com.yanqu.road.server.cmd.base.AbstractCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.manger.player.GamePlayerMgr;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.Protocol;

@Cmd(code = Protocol.S_CROSS_STRONGHOLD_MEMBER_CONDITION_NOTIFY, desc = "从其他服返回过来的")
public class StrongholdActivityMemberConditionDataNotifyCmd extends AbstractCommand {

	@Override
	public boolean parseData(YanQuMessage packet) throws Exception {
		StrongholdActivityProto.CrossStrongholdConditionUnionMemberDataRespMsg reqMsg = StrongholdActivityProto.CrossStrongholdConditionUnionMemberDataRespMsg.parseFrom(packet.getBytes());
		long userId = reqMsg.getUserId();
		GamePlayer player = GamePlayerMgr.getOnlinePlayer(userId);
		if(null != player){
            StrongholdActivityProto.StrongholdActivityConditionUnionMemberDataRespMsg.Builder msg = StrongholdActivityProto.StrongholdActivityConditionUnionMemberDataRespMsg.newBuilder();
            msg.setDataList(reqMsg.getDataList());
			msg.setRet(reqMsg.getRet());
			if(0 == reqMsg.getRet()){
				msg.setDataList(reqMsg.getDataList());
			}
			player.sendPacket(Protocol.U_STRONGHOLD_ACTIVITY_MEMBER_CONDITION_DATA, msg);
		}
		return true;
	}

	@Override
	public void execute(GamePlayer player, YanQuMessage packet) throws Exception {

	}

	@Override
	public void sendData(GamePlayer player) {

	}

}
